import React, { useState, useEffect } from 'react';
import { useLocation } from 'umi'
import Protocol from './components/protocol'
import Issue from './components/issue'
import Relation from './components/relation'

export default function(props){
  const [type, setType] = useState()
  const { query } = useLocation()

  useEffect(() => {
    const type = query?.type
    setType(type)
  }, [])

  return (
    <div>
      {type === 'protocol' ? <Protocol/> : ''}
      {type === 'issue' ? <Issue/> : ''}
      {type === 'relation' ? <Relation/> : ''}
    </div>
  )
}